fix(analytics): load GA4 tag only on production hosts - #24
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for capacitor-plugin-docs-stripe ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GA4 property
rdlabo-dev(properties/550016152, Asia/Tokyo) contains local development traffic:localhost+127.0.0.1accounted for 733 of 3,180 page_views over the latest complete 28 days (2026-08-07..09-03), ~23%. This distorts pageview and engagement figures used in the weekly analytics cycle.Both
projects/docs/src/index.htmlandprojects/web-site/src/index.htmlnow injectgtag.jsand callgtag('config', ...)only whenThe
window.gtagstub is still defined unconditionally, so app code (app.tspage_view /article_to_*events) is unchanged; on non-production hosts the calls simply push into adataLayerthat is never consumed. Documented inmarketing/analytics-access.md.Measurement plan:
localhost/127.0.0.1sessions in GA4 should drop to 0 from the deploy date (evaluate ≥ 7 days after merge). Guardrail: productionpage_viewvolume forrdlabo.dev/docs.rdlabo.devunchanged.Validation:
fmt:check,lint,ng test docs(48),ng test web-site(37) pass.build/seo:audit/ network-dependent contract tests not run locally (allowlist blocked raw.githubusercontent.com) — rely on CI.Link to Devin session: https://app.devin.ai/sessions/7c984b76130a4b01a1f9793370aa37bb
Open in Devin Desktop: https://app.devin.ai/desktop/session/7c984b76130a4b01a1f9793370aa37bb?variant=devin